There has been a lot of recent hype over the Rust Programming Language, and especially from a perspective of security, some desire to see an increase in the use of Rust in embedded systems.
The Zephyr RTOS has also seen a lot of activity recently.
It so happens, that I've spent the last 6 months working to make these work together. The most recently Zephyr Release explicitly states support for Rust. The question what can it do, and what is it useful for.
There are a few ways to approach supporting Rust on an RTOS. Some previous efforts have focused on bringing support for Rust std library to the platform. This can definitely help with porting of applications and that type of effort.
However, this also comes with a cost. The std library is built around a few assumptions that aren't really true on most of the platforms that Zephyr is used on:
alloc. On desktop and server type of machines,
assuming that dynamic allocation is available is fairly pervasive, and many of the abstractions in
the std library assume they are free to not just allocate, but allocate fairly freely. Embedded
systems are often significantly memory constrained (Having tends of Kb of ram is common).
Although using Rust addresses many of the concerns with using dynamic memory, there is still an
overhead to using it, and I feel it would be much better to build support for Zephyr without this
requirement. This aligns well with other projects with rust-embedded, including EmbassyAs such, this approach to support Rust on Zephyr has taken an approach closer to that done by the Rust Embedded project.
What an RTOS such as Zephyr provides can be broken down into a few categories:
malloc and free.core library, or in one of
the many crates. Binding to a utility written in C is likely to result in an inferior
experience to just using native functionality in Rust.